package com.cskaoyan.javase.thread._5pc._1wait_notify;

/**
 * sleep方法的阻塞不会释放锁,需要等待它休眠结束后,执行完sync后,才会释放锁
 * @since 11:34
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class TestSleep {
    public static void main(String[] args) {
        final Object o = new Object();
        synchronized (o) {
            System.out.println("666666666666");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("88888888888");
            System.out.println("88888888888");
            System.out.println("88888888888");
            System.out.println("88888888888");
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        synchronized (o) {
            System.out.println("777777");
        }
    }
}
